.lsp-completer-themes .lsp-licence {
  display: inline;
}

.lsp-completer-themes ul {
  list-style: none;
  padding-left: 10px;
}

.lsp-completer-theme-icons {
  margin-left: 10px;
}

.lsp-completer-icon-row {
  width: 50%;
  display: flex;
  justify-content: space-between;
}

body[data-lsp-completer-layout] .jp-Completer-docpanel {
  width: 300px;
  /* https://github.com/jupyterlab/jupyterlab/pull/15024 */
  flex-shrink: 0;
}

body[data-lsp-completer-layout] {
  /* Important to use selectors which work on body so that size estimation
  works when the list items get temporarily attached to the body */
  --lsp-completer-max-label-width: 400px;
  --lsp-completer-max-detail-width: 200px;
}

body[data-lsp-completer-layout] .jp-Completer-match {
  max-width: calc(
    var(--lsp-completer-max-label-width) + var(--lsp-completer-max-detail-width)
  );
  overflow-x: hidden;
  white-space: nowrap;
  display: block;
  text-overflow: ellipsis;
}

body[data-lsp-completer-layout] .jp-mod-active .jp-Completer-match {
  text-overflow: clip;
}

.lsp-completer-placeholder:after {
  content: 'Loading...';
  color: #7f7f7f;
}

/* a workaround for code being larger font size than text in markdown-rendered panel */
body[data-lsp-completer-layout] .jp-Completer-docpanel pre code {
  font-size: 90%;
}

body[data-lsp-completer-layout='detail-below'] .jp-Completer-item {
  --lsp-completer-label-height: 24px;
  --lsp-completer-detail-height: 20px;
  --lsp-completer-icon-width: 16px;
  height: var(--lsp-completer-label-height);
  display: grid;
  grid-template-areas:
    'icon label'
    'detail detail';
  grid-template-columns: min-content 1fr;
}

body[data-lsp-completer-layout='detail-below']
  .jp-Completer-item.jp-mod-active {
  height: calc(
    var(--lsp-completer-detail-height) + var(--lsp-completer-label-height)
  );
}

body[data-lsp-completer-layout='detail-below'] .jp-Completer-icon {
  grid-area: icon;
  width: var(--lsp-completer-icon-width);
}

body[data-lsp-completer-layout='detail-below'] .jp-Completer-match {
  grid-area: label;
  overflow: hidden;
  height: var(--lsp-completer-label-height);
}

body[data-lsp-completer-layout] .jp-Completer-item .jp-Completer-typeExtended {
  max-width: var(--lsp-completer-max-detail-width);
  min-height: 50px;
  overflow-x: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-lsp-completer-layout] .jp-mod-active .jp-Completer-typeExtended {
  text-overflow: clip;
}

body[data-lsp-completer-layout] mark.lsp-elide:first-child {
  display: inline-block;
  overflow-x: clip;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: rtl;
  /* stretch to as much space as possible */
  flex-shrink: 1;
  /* always reserve small space to fit the ellipsis */
  min-width: 20px;
  /* a reasonably long limit on the space taken by the elipsis */
  max-width: calc(var(--lsp-completer-max-label-width) / 2);
}

body[data-lsp-completer-layout] .lsp-elide-wrapper {
  display: flex;
}

body[data-lsp-completer-layout='detail-below'] .jp-Completer-typeExtended {
  grid-area: detail;
  text-align: left;
  padding-left: calc(var(--lsp-completer-icon-width) + 8px);
  height: var(--lsp-completer-detail-height);
  line-height: var(--lsp-completer-detail-height);
  display: none;
  position: relative;
  top: -2px;
  overflow: hidden;
  max-width: var(--lsp-completer-max-label-width);
}

body[data-lsp-completer-layout='detail-below'] .jp-Completer-match {
  overflow: hidden;
  max-width: var(--lsp-completer-max-label-width);
}

body[data-lsp-completer-layout='detail-below']
  .jp-Completer-item.jp-mod-active
  .jp-Completer-typeExtended {
  display: block;
}
